import { Rule, RuleType } from '@midwayjs/validate';
import { ApiProperty } from '@midwayjs/swagger';
import { BaseError as R } from '../../../common/base.error';
import { requiredString } from '../../../common/common.validate.rules';
import { DictManageEntity } from '../entity/dictManage';
import { BaseDTO } from '../../../common/base.dto';

export class DictManageDTO extends BaseDTO<DictManageEntity> {
  @ApiProperty({
    description: '字典编码',
  })
  @Rule(requiredString.error(R.validateError('字典编码不能为空')))
  code?: string;

  @ApiProperty({
    description: '字典名称',
  })
  @Rule(requiredString.error(R.validateError('字典名称不能为空')))
  name?: string;

  @ApiProperty({ description: '字典类型' })
  @Rule(requiredString.error(R.validateError('字典类型不能为空')))
  type?: string;

  @ApiProperty({ description: '字典排序' })
  @Rule(RuleType.allow(null))
  sort?: number

  @ApiProperty({ description: '字典描述' })
  @Rule(RuleType.allow(null))
  desc?: string
}